package com.gdpu.controller;

import com.gdpu.model.UmsAddress;
import com.gdpu.serivce.RedisService;
import com.gdpu.service.UmsAddressService;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.cache.annotation.Cacheable;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @Author:weiming
 * @Date:2021/6/19
 */
@RestController
@RequestMapping("redis")
public class RedisController {
    Logger logger = LoggerFactory.getLogger(RedisController.class);
    @Autowired
    private RedisService redisService;
    @Autowired
    private UmsAddressService umsAddressService;
    @GetMapping("set")
    public void set(){
        UmsAddress address = new UmsAddress();
        address.setUserAddress("你好");

        redisService.set("address",address);

        Object address1 = redisService.get("address");
        UmsAddress address2 = umsAddressService.get(2);
        logger.info(address1.toString());
    }


}
